class Button {
  constructor(key: string, label: string = '按钮', icon: string = '', type: string = 'primary') {
    this.key = key;
    this.label = label;
    this.type = type;
    this.icon = icon;
  }

  protected _params: object = {};
  set params(params: object) {
    this._params = params ? params : {};
  }
  get params() {
    return {
      key: this.key,
      label: this.label,
      type: this.type,
      icon: this.icon,
      size: this.size,
      color: this.color,
    };
  }

  action() {
    return {
      key: this.key,
      label: this.label,
      icon: this.icon,
      auth: 'super',
    };
  }

  private _key: string = '';
  set key(key: string) {
    this._key = key;
  }
  get key() {
    return this._key;
  }

  private _label: string = '';
  set label(label: string) {
    this._label = label;
  }
  get label() {
    return this._label;
  }

  private _type: string = '';
  set type(type: string) {
    this._type = type;
  }
  get type() {
    return this._type;
  }

  private _icon: string = '';
  set icon(icon: string) {
    this._icon = icon;
  }
  get icon() {
    return this._icon;
  }

  private _size: string = '';
  set size(size: string) {
    this._size = size;
  }
  get size() {
    return this._size;
  }

  private _color: string = '';
  set color(color: string) {
    this._color = color;
  }
  get color() {
    return this._color;
  }

  plus() {
    this.key = 'plus';
    this.label = '新增';
    this.icon = 'mdi:plus-outline';
    this.color = '';
    return this.params;
  }
  remove() {
    this.key = 'remove';
    this.label = '移除';
    this.icon = 'mdi:close-outline';
    this.color = '';
    return this.params;
  }
  download() {
    this.key = 'download';
    this.label = '下载';
    this.icon = 'mdi:cloud-download-outline';
    this.color = 'warning';
    return this.params;
  }
  trash() {
    this.key = 'trash';
    this.label = '回收站';
    this.icon = 'mdi:delete-outline';
    this.color = '';
    return this.params;
  }
  recovery() {
    this.key = 'recovery';
    this.label = '恢复';
    this.icon = 'mdi:delete-restore';
    this.color = '';
    return this.params;
  }
  clean() {
    this.key = 'clean';
    this.label = '清除';
    this.icon = 'mdi:trash-can-outline';
    this.color = 'error';
    return this.params;
  }
}

export default Button;
